<style>
    body {
        background-color: #ffffff;
    }

    .xm-select-size {
        width: 200px;
        float: left;
    }
</style>
<div class="layui-form layuimini-form">
    <div class="layui-form-item">
        <label class="layui-form-label required">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="move_user" lay-verify="required" lay-reqtext="用户名不能为空" placeholder="请输入用户名"
                   value=""
                   class="layui-input" autocomplete="off">
            <tip></tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">密码</label>
        <div class="layui-input-block">
            <input type="password" name="move_pwd" autocomplete="off" placeholder="请输入密码" lay-verify="required"
                   lay-reqtext="密码不能为空" value="" class="layui-input">
            <tip></tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">确认密码</label>
        <div class="layui-input-block">
            <input type="password" name="move_pwd_res" autocomplete="off" placeholder="请输入确认密码" lay-verify="required"
                   lay-reqtext="确认密码不能为空" value="" class="layui-input">
            <tip></tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">选择角色</label>
        <div class="layui-input-block">
            <div id="ruleId"></div>
        </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</div>
<script type="text/javascript">
    layui.config({
        base: '/static/extends/'
    }).extend({
        xmSelect: 'xmSelect/xm-select'
    });
    layui.use(['form', 'xmSelect', "upload", "element"], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$,
            xmSelect = layui.xmSelect,
            upload = layui.upload,
            element = layui.element;
        var demo1 = xmSelect.render({
            el: '#ruleId',
            radio: true,
            toolbar: {show: true},
            clickClose: true,
            data: [],
            name: "rule_id"
        })
        //监听提交
        form.on('submit(saveBtn)', function (data) {
            hadmin.http("{:url('save')}", data.field).then(res => {
                if (res.code == "{$result.normal}") {
                    hadmin.father_reload();
                }
            })

            return false;
        });
        hadmin.http("{:url('rule/getRuleByList')}").then(res => {
            if (res.code == "{$result.normal}") {
                demo1.update({
                    data: res.data
                })
            }
        })
    });
</script>
</body>
</html>
